package org.zhouhe.modules.servingProcess.action;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.zhouhe.base.BaseAction;
import org.zhouhe.modules.servingProcess.service.ServingProcessService;
import org.zhouhe.vo.ServingProcess;

public class ServingProcessAction extends BaseAction {

	private static final long serialVersionUID = 896164905733014622L;
	private ServingProcess servingProcess = new ServingProcess();
	private List<ServingProcess> servingProcessList;
	@Autowired
	private ServingProcessService servingProcessService;

	public String saveOrUpdate() {
		Integer id = servingProcess.getServingProcessId();
		if(id != null){
			servingProcess = servingProcessService.getServingProcess(id);
		}
		return "saveOrUpdate";
	}

	public String saveOrUpdateDo() {
		servingProcessService.saveOrUpdate(servingProcess);
		return "saveOrUpdateDo";
	}

	public String delete() {
		servingProcessService.delete(servingProcess);
		return "delete";
	}

	public String list() {
		setServingProcessList(servingProcessService.getServingProcessList());
		return "list";
	}
	public String updateOrder(){
		servingProcessService.updateDisplayOrder(servingProcessList);
		return "updateOrder";
	}

	public void setServingProcess(ServingProcess servingProcess) {
		this.servingProcess = servingProcess;
	}

	public ServingProcess getServingProcess() {
		return servingProcess;
	}

	public void setServingProcessList(List<ServingProcess> servingProcessList) {
		this.servingProcessList = servingProcessList;
	}

	public List<ServingProcess> getServingProcessList() {
		return servingProcessList;
	}

}
